-module(material).
-export([new/0, new/5]).
-export([get_id/1, set_id/2]).
-export([get_roughness/1, set_roughness/2]).
-export([get_transmittance/1, set_transmittance/2]).
-export([get_ior/1, set_ior/2]).
-export([get_color/1, set_color/2]).

-record(material, {
            id=0,
            roughness=1,
            transmittance=0,
            ior=1.55,
            color=color:white()
       }).

new() -> #material{}.
new(Id, Roughness, Transmittance, IOR, Color) ->
    #material{id=Id, roughness=Roughness, transmittance=Transmittance, ior=IOR, color=Color}.

get_id(Material) -> Material#material.id.
set_id(Id, Material) -> Material#material{id=Id}.

get_roughness(Material) -> Material#material.roughness.
set_roughness(Roughness, Material) -> Material#material{roughness=Roughness}.

get_transmittance(Material) -> Material#material.transmittance.
set_transmittance(Transmittance, Material) -> Material#material{transmittance=Transmittance}.

get_ior(Material) -> Material#material.ior.
set_ior(IOR, Material) -> Material#material{ior=IOR}.

get_color(Material) -> Material#material.color.
set_color(Color, Material) -> Material#material{color=Color}.